#!/usr/bin/env python
# -*- coding: utf-8 -*-


"""
 -c config 文件
 --data 要注册的数据文件

"""

from .utils import tools
from .utils import odoorpc

# dev_1,dev_1_1,temperature
# dev_1,dev_1_2,moisture


def main():
    data = tools.get_csv_data()
    print(data)
    # file_name = tools.get_arg('--data')
    # csv_out_name = file_name[0:-4] + '_out.csv'

    cfg = tools.get_config()
    print('cfg,', cfg)

    options = cfg.get('options')
    odoo = odoorpc.get_odoo(**options)
    recs = [odoo.env['iot.device'].regsiter(rec) for rec in data]
    print('regsiter', recs)

    # tools.set_csv_data(csv_out_name, recs)
